<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"  
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Comment For Visitor</title>
    </h:head>
    <h:body>
        <h:form id="commentFormForVisitor">
            <h:panelGrid id="commentOnArticlePanelForVisitor">  
                <h:outputLabel for="emailForVisitor" value="Visitor Email(*):"/>           
                <p:inputText id="emailForVisitor" value="#{commentBean.comment.visitorEmail}" required="true" label="Visitor Email" validatorMessage="#{commentBean.comment.visitorEmail} is not valid">
                    <f:validateRegex pattern="[\w\.-]*[a-zA-Z0-9_]@[\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]" />
                </p:inputText>
                <p:message for="emailForVisitor" />
                <h:outputLabel for="nameForVisitor" value="Visitor Name(*):"/>
                <p:inputText  value="#{commentBean.comment.visitorName}" id="nameForVisitor" required="true"   />                        
                <p:message for="nameForVisitor"/>
                <h:outputLabel for="commentBodyForVisitor" value="Comment Body(*):"/>
                <p:inputTextarea rows="10" cols="40" value="#{commentBean.commentBody}" id="commentBodyForVisitor" required="true"   />                        
                <p:message for="commentBodyForVisitor"/>
                <h:outputLabel for="websiteForVisitor" value="Visitor Website(optional):"/>
                <p:inputText value="#{commentBean.comment.visitorWebsite}" id="websiteForVisitor"/>                        
                <p:message for="websiteForVisitor"/>                         
                <br></br>
                <p:commandButton value="Post Comment" action="#{commentBean.persistForVisitor()}" update="commentOnArticlePanelForVisitor" ></p:commandButton>
            </h:panelGrid> 
        </h:form>
    </h:body>
</html>

